package com.gaga.metadata.common.enums;

/**
 * 转换类型
 * TransFormType
 **/
public enum TransFormType {

    Greenplum("Greenplum", "org.postgresql.Driver", "jdbc:postgresql://"),
    Postgresql("Postgresql", "org.postgresql.Driver", "jdbc:postgresql://"),
    //兼容老版本
    Postgres("Postgres", "org.postgresql.Driver", "jdbc:postgresql://"),

    Doris("Doris", "com.mysql.cj.jdbc.Driver", "jdbc:mysql://"),
    StarRocks("StarRocks", "com.mysql.cj.jdbc.Driver", "jdbc:mysql://"),

    Mysql("Mysql", "com.mysql.cj.jdbc.Driver", "jdbc:mysql://"),

    Oracle("Oracle", "oracle.jdbc.OracleDriver", "jdbc:Oracle:thin:@"),

    Sqlserver("Sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://");


    private String type;
    private String driverClass;

    private String urlPrefix;

    TransFormType(String type, String driverClass, String urlPrefix) {
        this.type = type;
        this.driverClass = driverClass;
        this.urlPrefix = urlPrefix;
    }

    public String getType() {
        return type;
    }

    public String getDriverClass() {
        return driverClass;
    }

    public String getUrlPrefix() {
        return urlPrefix;
    }

    public static TransFormType ofCode(String code) {
        for (TransFormType transFormType : values()) {

            if (transFormType.getType().equalsIgnoreCase(code)) {
                return transFormType;
            }
        }
        return null;
    }


}
